using System;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;

namespace OrderingSystem.Core.Entities
{
    [Table("discusscaipinxinxi")]
    public class DishDiscussion
    {
        [Column("id")]
        public long id { get; set; }

        /// <summary>
        /// 添加时间
        /// </summary>
        [Column("addtime")]
        public DateTime addtime { get; set; }

        /// <summary>
        /// 菜品名称 - 非数据库字段
        /// </summary>
        [NotMapped]
        public string caipinmingcheng { get; set; }

        /// <summary>
        /// 菜品分类 - 非数据库字段
        /// </summary>
        [NotMapped]
        public string caipinfenlei { get; set; }

        /// <summary>
        /// 评论内容
        /// </summary>
        [Column("content")]
        public string content { get; set; }

        /// <summary>
        /// 回复内容
        /// </summary>
        [Column("reply")]
        public string reply { get; set; }

        /// <summary>
        /// 用户名 - 非数据库字段
        /// </summary>
        [NotMapped]
        public string yonghuming { get; set; }

        /// <summary>
        /// 用户ID
        /// </summary>
        [Column("userid")]
        public long userid { get; set; }

        /// <summary>
        /// 菜品ID
        /// </summary>
        [Column("refid")]
        public long refid { get; set; }

        // 以下是为了兼容C#代码而保留的属性，但在JSON序列化时会被忽略
        [JsonIgnore]
        [NotMapped]
        public long Id { get => id; set => id = value; }

        [JsonIgnore]
        [NotMapped]
        public DateTime AddTime { get => addtime; set => addtime = value; }

        [JsonIgnore]
        [NotMapped]
        public string CaipinMingCheng { get => caipinmingcheng; set => caipinmingcheng = value; }

        [JsonIgnore]
        [NotMapped]
        public string CaipinFenlei { get => caipinfenlei; set => caipinfenlei = value; }

        [JsonIgnore]
        [NotMapped]
        public string TaoLunNeiRong { get => content; set => content = value; }

        [JsonIgnore]
        [NotMapped]
        public string HuiFuNeiRong { get => reply; set => reply = value; }

        [JsonIgnore]
        [NotMapped]
        public string YongHuMing { get => yonghuming; set => yonghuming = value; }

        [JsonIgnore]
        [NotMapped]
        public long UserId { get => userid; set => userid = value; }

        [JsonIgnore]
        [NotMapped]
        public long DishId { get => refid; set => refid = value; }

        [ForeignKey("userid")]
        public User User { get; set; }

        [ForeignKey("refid")]
        public Dish Dish { get; set; }
    }
} 